package handle

import (
	"gitee.com/crack007/goose/core/command"
	"gitee.com/crack007/goose/injection"
	"github.com/crack007/go-im/src/common/config"
	"github.com/crack007/go-im/src/module/consumer/service"
)

type consumerHandle struct {
	command.DefaultCmdHandle
}

func NewConsumerHandle() *consumerHandle {
	return &consumerHandle{}
}

func (h *consumerHandle) OnInitConfig() {
	config.InitAppConfig()
}

func (h *consumerHandle) OnInitInject() []injection.Service {
	return []injection.Service{injection.REDIS_SERVICE, injection.MYSQL_SERVICE}
}
func (h *consumerHandle) OnInitService() {

	service.RegisterConsumerService()
}

func (h *consumerHandle) OnRun() error {
	return service.ConsumerService.Bootstrap(h.GetCmd().Ctx)
}
